package com.jbm.core.server;

import com.jbm.core.client.MainCallback;
import com.jbm.core.common.ConnectAgent;
import com.jbm.core.iface.IFileObject;
import com.jbm.onehome.iface.*;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by root on 17-3-3.
 */
public class AccountCallback implements MainCallback
{
	protected SAccount m_sa;

	public AccountCallback()
	{
		m_sa = null;
	}

	public AccountCallback(SAccount sa)
	{
		this();

		m_sa = sa;
	}

	@Override
	public void NewAccount(ConnectAgent ca)
	{
	}

	@Override
	public void RemoveAccount(Integer account_id)
	{
	}

	@Override
	public void UpdateAccount(boolean pullall, ConnectAgent ca)
	{
		m_sa.PushCA2Contact(pullall,m_sa.getM_account_id(),ca);
	}

	@Override
	public void OfflineAccount(int status, ConnectAgent ca)
	{
		m_sa.OfflineCA4Contact(m_sa.getM_account_id(),status, ca);
	}

	@Override
	public void NewDevice( ConnectAgent ca )
	{
	}

	@Override
	public void RemoveDevice( Integer account_id )
	{
	}

	@Override
	public void UpdateDevice( boolean pullall, ConnectAgent ca )
	{
		m_sa.PushCA2Contact(pullall,m_sa.getM_account_id(),ca);
	}

	@Override
	public void OfflineDevice( ConnectAgent ca )
	{
		m_sa.OfflineCA4Contact(m_sa.getM_account_id(),0,ca);
	}

	@Override
	public void CGNewText( int cg_id, Integer account_id, String text, long timestamp )
	{
		System.out.println("CGText:"+text);
	}

	@Override
	public void CGNewFile(int cg_id, Integer account_id, IFileObject fo, long timestamp )
	{
	}

	@Override
	public void NewPay (Integer account_id, String msg, BigDecimal fee, String paytype, long timestamp)
	{
	}

	@Override
	public void NewText( Integer account_id, String text, long timestamp )
	{
		System.out.println(text+"2.032.032.032.032.032.032.03");
	}

	@Override
	public void NewFile(Integer account_id, IFileObject fo, long timestamp )
	{
	}

	@Override
	public void AddContact(ContactEntity ce)
	{
		System.out.println("Add Contact account:"+ce.getAccount());
	}
	@Override
	public void DropContact(ContactEntity ce)
	{
		System.out.println("Drop Contact account:"+ce.getAccount());
	}

	@Override
	public void Belogout()
	{
		System.out.println("Belogout");
	}

	@Override
	public List<String> getAllIFace()
	{
		return null;
/*
		return Arrays.asList(("com.jbm.core.iface.IAcross|"+
				"com.jbm.core.iface.ICallGroup|"+
				"com.jbm.core.iface.IConnectAgent|"+
				"com.jbm.core.iface.IFileObject|"+
				"com.jbm.core.iface.IP2P|"+
				"com.jbm.core.iface.IRegister|"+
				"com.jbm.onehome.iface.AccSecretEntity|"+
				"com.jbm.onehome.iface.AlipaylogEntity|"+
				"com.jbm.onehome.iface.AppJudgeEntity|"+
				"com.jbm.onehome.iface.BalanceEntity|"+
				"com.jbm.onehome.iface.BusAuditLogEntity|"+
				"com.jbm.onehome.iface.BusinessEntity|"+
				"com.jbm.onehome.iface.CapitalAccEntity|"+
				"com.jbm.onehome.iface.CertAddressEntity|"+
				"com.jbm.onehome.iface.ClickTimesEntity|"+
				"com.jbm.onehome.iface.ContactEntity|"+
				"com.jbm.onehome.iface.EguardBtEntity|"+
				"com.jbm.onehome.iface.EguardKeyEntity|"+
				"com.jbm.onehome.iface.EguardLogEntity|"+
				"com.jbm.onehome.iface.EnchashmentEntity|"+
				"com.jbm.onehome.iface.EntranceGuardEntity|"+
				"com.jbm.onehome.iface.ExchangeEntity|"+
				"com.jbm.onehome.iface.ExProductEntity|"+
				"com.jbm.onehome.iface.FocusEntity|"+
				"com.jbm.onehome.iface.GeoInfoEntity|"+
				"com.jbm.onehome.iface.GiGiHstyEntity|"+
				"com.jbm.onehome.iface.GoodsEntity|"+
				"com.jbm.onehome.iface.IAccCtrl|"+
				"com.jbm.onehome.iface.IAcc|"+
				"com.jbm.onehome.iface.IAplipay|"+
				"com.jbm.onehome.iface.IAPPJudge|"+
				"com.jbm.onehome.iface.IAppVersion|"+
				"com.jbm.onehome.iface.IAttachment|"+
				"com.jbm.onehome.iface.IBreakJob|"+
				"com.jbm.onehome.iface.IBusinessCtrl|"+
				"com.jbm.onehome.iface.ICertAddressCtrl|"+
				"com.jbm.onehome.iface.ICertAddress|"+
				"com.jbm.onehome.iface.IConfirmJob|"+
				"com.jbm.onehome.iface.IDownloadMedia|"+
				"com.jbm.onehome.iface.IEGLogCtrl|"+
				"com.jbm.onehome.iface.IEGLog|"+
				"com.jbm.onehome.iface.IEGuard|"+
				"com.jbm.onehome.iface.IEGuardKeyCtrl|"+
				"com.jbm.onehome.iface.IEGuardKey|"+
				"com.jbm.onehome.iface.IExChangeCtrl|"+
				"com.jbm.onehome.iface.IGeoEntityCtrl|"+
				"com.jbm.onehome.iface.IGeoinfoCtrl|"+
				"com.jbm.onehome.iface.IGeoinfo|"+
				"com.jbm.onehome.iface.IGetJobList|"+
				"com.jbm.onehome.iface.IInformationCtrl|"+
				"com.jbm.onehome.iface.IJobTotal|"+
				"com.jbm.onehome.iface.IJOrderCtrl|"+
				"com.jbm.onehome.iface.IJOrder|"+
				"com.jbm.onehome.iface.ILoadJob|"+
				"com.jbm.onehome.iface.ILoginCtrl|"+
				"com.jbm.onehome.iface.ILogin|"+
				"com.jbm.onehome.iface.InfoAttachmentEntity|"+
				"com.jbm.onehome.iface.InfoAuditLogEntity|"+
				"com.jbm.onehome.iface.InfoGeoPriceEntity|"+
				"com.jbm.onehome.iface.InfomationEntity|"+
				"com.jbm.onehome.iface.InfoScopeEntity|"+
				"com.jbm.onehome.iface.IOrderCtrl|"+
				"com.jbm.onehome.iface.IorderEntity|"+
				"com.jbm.onehome.iface.IOrder|"+
				"com.jbm.onehome.iface.IOtherConfigCtrl|"+
				"com.jbm.onehome.iface.IPayCtrl|"+
				"com.jbm.onehome.iface.IPay|"+
				"com.jbm.onehome.iface.IpointsCtrl|"+
				"com.jbm.onehome.iface.IRegistCustomer|"+
				"com.jbm.onehome.iface.ISaleActivity|"+
				"com.jbm.onehome.iface.ISecretCtrl|"+
				"com.jbm.onehome.iface.ISecret|"+
				"com.jbm.onehome.iface.ISellerCtrl|"+
				"com.jbm.onehome.iface.ISeller|"+
				"com.jbm.onehome.iface.IStatBrokenEGuard|"+
				"com.jbm.onehome.iface.IStatCtrl|"+
				"com.jbm.onehome.iface.IStatDayEGuard|"+
				"com.jbm.onehome.iface.IStatEGuardLog|"+
				"com.jbm.onehome.iface.IStatVillage|"+
				"com.jbm.onehome.iface.ISubmitJob|"+
				"com.jbm.onehome.iface.ITotal|"+
				"com.jbm.onehome.iface.ITrafficRstr|"+
				"com.jbm.onehome.iface.IUploadMedia|"+
				"com.jbm.onehome.iface.IVerifyCode|"+
				"com.jbm.onehome.iface.IVersion|"+
				"com.jbm.onehome.iface.IWeatherCtrl|"+
				"com.jbm.onehome.iface.IWeather|"+
				"com.jbm.onehome.iface.JobOrderEntity|"+
				"com.jbm.onehome.iface.JordAttachmentEntity|"+
				"com.jbm.onehome.iface.LoginEntity|"+
				"com.jbm.onehome.iface.Login|"+
				"com.jbm.onehome.iface.LoginLogEntity|"+
				"com.jbm.onehome.iface.LoginRoleEntity|"+
				"com.jbm.onehome.iface.Media|"+
				"com.jbm.onehome.iface.MemberEntity|"+
				"com.jbm.onehome.iface.MemLoginHstyEntity|"+
				"com.jbm.onehome.iface.MGiEntity|"+
				"com.jbm.onehome.iface.OrdAttachmentEntity|"+
				"com.jbm.onehome.iface.OrderItemsEntity|"+
				"com.jbm.onehome.iface.OtherconfigEntity|"+
				"com.jbm.onehome.iface.PaybackEntity|"+
				"com.jbm.onehome.iface.PicInputStream|"+
				"com.jbm.onehome.iface.PicOutputStream|"+
				"com.jbm.onehome.iface.PointsEntity|"+
				"com.jbm.onehome.iface.PointsRuleEntity|"+
				"com.jbm.onehome.iface.PraiseEntity|"+
				"com.jbm.onehome.iface.RoleEntity|"+
				"com.jbm.onehome.iface.SellerEntity|"+
				"com.jbm.onehome.iface.SellerLoginHstyEntity|"+
				"com.jbm.onehome.iface.StatisticalReportEntity|"+
				"com.jbm.onehome.iface.TrafficrstrEntity|"+
				"com.jbm.onehome.iface.VEguardLogEntity|"+
				"com.jbm.onehome.iface.VerifyCodeEntity|"+
				"com.jbm.onehome.iface.VoucherEntity|"+
				"com.jbm.onehome.iface.WeatherEntity|"+
				"com.jbm.onehome.iface.WxpaylogEntity").split("\\|"));
*/
	}

	@Override
	public void ReConnect()
	{
	}

	@Override
	public void GPConfirmStart( int cg_id )
	{
		System.out.println("GPConfirmStart cg_id = "+cg_id);
	}

	@Override
	public void GPSelectCertAddress (int cg_id, ICertAddress[] ca)
	{
		System.out.println("GPConfirmStart count = "+ca.length+"0:"+ca[0].gi_text+"1:"+ca[1].gi_text+"2:"+ca[2].gi_text);
	}

	@Override
	public void GPSelectCatalog (int cg_id, List<GoodsEntity> glist)
	{
		System.out.println("GPSelectCatalog count = "+glist.size()+"0:"+glist.get(0).getGoodsName()
				+"1:"+glist.get(1).getGoodsName()
				+"2:"+glist.get(2).getGoodsName());
	}

	@Override
	public void GPSelectTeam (int cg_id, String[] team)
	{
		System.out.println("GPSelectTeam count = "+team.length+"0:"+team[0]+"1:"+team[1]+"2:"+team[2]);
	}

	@Override
	public void DeliverCode (String code,String memo,Integer from_id,Integer to_id,long timestamp)
	{
	}


	@Override
	public void orderStatus(IorderEntity iorderEntity)
	{
		System.out.println("订单:"+iorderEntity.getItemDesc());

	}


	@Override
	public void jobOrderStatus(JobOrderEntity iorderEntity)
	{

	}

	@Override
	public void addToUnit(CallGroupEntity cg)
	{
		System.out.println(cg.getCgId()+"cgid");
	}

}